package com.example.code.class03;

import java.util.HashSet;
import java.util.Set;

/**
 * @Date 2022/7/17
 * @Created by Jonathan
 */
public class Code02_HowManyTypes {
    public static void main(String[] args) {
        String[] arr = new String[]{"abc", "aabbcc"};
        System.out.println(types(arr));
    }

    public static int types(String[] arr) {
        Set<Integer> ret = new HashSet<>();
        for (String s : arr) {
            final char[] chs = s.toCharArray();
            int key = 0;
            for (char ch : chs) {
                // todo  研究一下这个位运算
                key |= (1 << ch - 'a');
            }
            ret.add(key);
        }
        return ret.size();
    }
}
